<?php


namespace App\Services\Business\Models;

use App\Models\AdministratorRole;
use App\Services\Business\Models\Base;
use App\Services\Business\Models\Comment;
use App\Services\Business\Models\ThumbsUp;
use App\Services\Member\Models\User;
use App\Services\Member\Models\Activity;
use App\Services\Member\Models\UserProfile;
use Carbon\Carbon;


class Wish extends Base
{


    protected $table = 'wish';


    protected $fillable = [
        'user_id', 'title','days', 'status','remain_point', 'thumb', 'thumb_small', 'is_public', 'is_hide', 'start_at', 'days', 'point', 'view_count', 'favorite_count', 'thumbsup_count', 'comments_count','remain_point'
    ];


    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }


    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function fragments()
    {
        return $this->hasMany(WishFragment::class, 'wish_id');
    }



    public function activity()
    {
        return $this->morphMany(Activity::class, 'activityable');
    }


    public function comments()
    {
        return $this->morphMany(Comment::class, 'commentable');
    }

    public function thumbsups()
    {
        return $this->morphMany(ThumbsUp::class, 'thumbsupable');
    }

    public function list()
    {
        return $this->hasOne(WishList::class, 'wish_id');
    }



}
